package threadlocal;

/**
 * @author chaird
 * @create 2021-05-15 18:42
 */
public class ThreadLocalDemo {


  public static void main(String[] args) {
    ThreadLocal threadLocal = new ThreadLocal();
    // 在当前线程中设置了一个数据
    threadLocal.set("userId:zhangsan");


    threadLocal.remove();

    new Thread(
            () -> {
              System.out.println("new thread:"+threadLocal.get());
            },
            "name")
        .start();
  }


}
